package com.mz.ozy.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.jude.rollviewpager.adapter.StaticPagerAdapter;
import com.mz.ozy.R;
import com.mz.ozy.bean.HomeBean;
import com.mz.ozy.bean.SortBean;
import com.mz.ozy.utils.glideUtils.GlideUtils;

import java.util.List;


/**
 *
 */

public class ScheduledBannerAdapter extends StaticPagerAdapter {

    private List<SortBean.ImgBannerBean> mBannerListBeans;

    public ScheduledBannerAdapter(Context context, List<SortBean.ImgBannerBean> mBannerListBeans) {
        this.mBannerListBeans = mBannerListBeans;
    }

    @Override
    public View getView(ViewGroup container, int position) {
        ImageView view = new ImageView(container.getContext());
        view.setScaleType(ImageView.ScaleType.FIT_XY);
        view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
        GlideUtils.loadBackImg(container.getContext(), view, mBannerListBeans.get(position).getImgPath(), R.mipmap.default_main_banner);
        return view;
    }

    @Override
    public int getCount() {
        return mBannerListBeans.size();
    }

    public SortBean.ImgBannerBean getItem(int position) {
        return mBannerListBeans.get(position);
    }
}
